// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   nseer_dbb.java

package include.nseer_db;

import java.io.*;
import java.sql.*;
import java.util.Properties;

public class nseer_dbb
{

	private Connection a;
	private Statement statement;
	private String drivername;
	private String database;
	private String url1;
	private String url2;

	public nseer_dbb(String file, String file1, String s)
	{
		getProperty(file, file1);
		database = s;
		String s1 = (new StringBuilder(String.valueOf(url1))).append(s).append("?").append(url2).toString();
		String s2 = drivername;
		try
		{
			Class.forName(s2);
		}
		catch (ClassNotFoundException classnotfoundexception)
		{
			classnotfoundexception.printStackTrace();
		}
		try
		{
			a = DriverManager.getConnection(s1);
			statement = a.createStatement();
		}
		catch (SQLException sqlexception)
		{
			sqlexception.printStackTrace();
		}
	}

	public void close()
	{
		try
		{
			statement.close();
			a.close();
		}
		catch (SQLException sqlexception)
		{
			sqlexception.printStackTrace();
		}
	}

	public ResultSet executeQuery(String s)
	{
		ResultSet resultset = null;
		try
		{
			resultset = statement.executeQuery(s);
		}
		catch (SQLException sqlexception)
		{
			sqlexception.printStackTrace();
		}
		return resultset;
	}

	public void executeUpdate(String s)
	{
		try
		{
			statement.executeUpdate(s);
		}
		catch (SQLException sqlexception)
		{
			sqlexception.printStackTrace();
		}
	}

	public String getTable()
	{
		return database;
	}

	public void getProperty(String file, String file1)
	{
		Properties properties = new Properties();
		Properties properties1 = new Properties();
		try
		{
			InputStream inputstream = getClass().getClassLoader().getResourceAsStream((new StringBuilder("/conf/")).append(file).toString());
			InputStream inputstream1 = getClass().getClassLoader().getResourceAsStream((new StringBuilder("/conf/")).append(file1).toString());
			properties.load(inputstream);
			properties1.load(inputstream1);
			if (inputstream != null)
				inputstream.close();
			inputstream1.close();
		}
		catch (IOException ex)
		{
			System.err.println("Open Propety File Error");
		}
		drivername = properties.getProperty("DRIVER");
		url1 = (new StringBuilder(String.valueOf(properties.getProperty("URL1")))).append(properties1.getProperty("IP")).append(":3306/").toString();
		url2 = properties.getProperty("URL2");
	}

	public void setTable(String s)
	{
		database = s;
	}
}
